package com.ty.day5;

import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * Author : txy
 * Create 2023/11/1 16:04
 */
public class Four {
    public static void main(String[] args) {
        int[] a = {2, 4, 5, 6, 7, 9, 12, 1, 2, 3, 4, 5};
        int m = 4, x = m;
        System.out.println("原来的排序：");
        System.out.println(Arrays.toString(a));
        int t;
        while (m > 0) {
            t = a[a.length - 1];
            for (int i = a.length - 1; i > 0; i--) {
                a[i] = a[i - 1];
            }
            a[0] = t;
            m--;
        }
        System.out.println("\n后" + x + "个数移动后：");
        System.out.println(Arrays.toString(a));
    }
}
